<?php

/****************************************************
DESCRIPTION: 	GENERAL OPTIONS
OPTION HANDLE: 	canon_options_appearance
****************************************************/


	/****************************************************
	REGISTER MENU
	****************************************************/

	add_action('admin_menu', 'register_canon_options_appearance');

	function register_canon_options_appearance () {
		global $screen_handle_canon_options_appearance;	  	//this is the SCREEN handle used to identify the new admin menu page (notice: different than the add_menu_page handle)

		// Use this instad if submenu
		$screen_handle_canon_options_appearance = add_submenu_page(
			'handle_canon_options',				//the handle of the parent options page. 
			'Appearance Settings',					//the submenu title that will appear in browser title area.
			'Appearance',								//the on screen name of the submenu
			'manage_options',						//privileges check
			'handle_canon_options_appearance',				//the handle of this submenu
			'display_options_appearance'				//the callback function to display the actual submenu page content.
		);

	}

	/****************************************************
	INITIALIZE MENU
	****************************************************/

	add_action('admin_init', 'init_canon_options_appearance');	
	
	function init_canon_options_appearance () {
		register_setting(
			'group_canon_options_appearance',				//group name. The group for the fields custom_options_group
			'canon_options_appearance',						//the options variabel. THIS IS WEHERE YOUR OPTIONS ARE STORED.
			'validate_canon_options_appearance'				//optional 3rd param. Callback /function to sanitize and validate
		);

		//if this is first runthrough set default values
		if (get_option('canon_options_appearance') == FALSE) {		//trying to get options 'canon_options_appearance' which doesn't yet exist results in FALSE
		 	$options = array (

					'color_bg'							=> '#fff',
					'color_body_text'					=> '#656a6f',
					'color_body_link'					=> '#4f565e',
					'color_main'						=> '#fd542d',
					'color_button_bg'					=> '#fd542d',
					'color_button_text'					=> '#fff',
					'color_button_bg_hover'				=> '#3c464c',
					'color_button_text_hover'			=> '#fff',
					'color_headings'					=> '#2d3438',
					'color_bold'						=> '#2d3438',
					'color_masthead_bg'					=> '#333',
					'color_masthead_headings'			=> '#fff',
					'color_feature2'					=> '#119ada',
					'color_meta'						=> '#9fadb4',
					'color_rulers'						=> '#d6dce0',
					'color_footer_bg'					=> '#f2f2f2',
					'color_menu_text'					=> '#fff',
					'color_inputs'						=> '#f6f6f6',

				 	'font_main'        					=> array('canon_default','',''),
				 	'font_bold'        					=> array('canon_default','',''),
				 	'font_quote'        				=> array('canon_default','',''),
				 	'font_nav'        					=> array('canon_default','',''),
				 	'font_italic'        				=> array('canon_default','',''),
				 	'font_field'        				=> array('canon_default','',''),

					'lightbox_overlay_color'			=> '#000000',
					'lightbox_overlay_opacity'			=> '0.7',
					
					'anim_slider'						=> 'checked',
					'anim_slider_delay'					=> '5000',
					'anim_slider_anim_duration'			=> '800',
					'anim_img_slider_slideshow'			=> 'unchecked',
					'anim_img_slider_delay'				=> '5000',
					'anim_img_slider_anim_duration'		=> '800',
					'anim_quote_slider_slideshow'		=> 'unchecked',
					'anim_quote_slider_delay'			=> '5000',
					'anim_quote_slider_anim_duration'	=> '800',

					'use_final_call_css'				=> 'unchecked',

				);

			update_option('canon_options_appearance', $options);
		}
	}


	/****************************************************
	VALIDATE INPUT AND DISPLAY MENU
	****************************************************/

	//remember this will strip all html php tags, strip slashes and convert quotation marks. This is not always what you want (maybe you want a field for HTML?) why you might want to modify this part.	
	function validate_canon_options_appearance ($new_instance) {				
		return $new_instance;
	}

	//display the menus
	function display_options_appearance () {
		require "options_appearance.php";
	}